dojo.ready(function() {
    service.getCursos()
    .addCallback(function(result) {
        var buffer = '';
        result.forEach(function(element) {
            var toLink = function(target) {
                return '<a href="/curso.html#' + element._id + '">' + target + '</a>'
            };
            buffer += '<tr><td>'
                + toLink(element._id)
                + '</td><td>'
                + toLink(decodeURI(element.nome))
                + '</td><td>'
                + (element.pos ? 's' : 'n')
                + '</td></tr>';
        });
        document.getElementById('cursos').innerHTML += buffer;
    })
    .addErrback(onErrback);

    document.title = 'Departamentos - D.A.R. - Vinipsmaker labs';
});